package android.slc.appdb.sys.entity;

import android.slc.db.entity.IDbExpand;

import com.blankj.utilcode.util.NumberUtils;

import java.util.LinkedHashMap;

public class DbExpand extends LinkedHashMap<String, Object> implements IDbExpand {

    private Integer getInt(String key) {
        Object value = get(key);
        if (value == null) {
            return null;
        }
        if(value instanceof Integer){
            return (Integer) value;
        }
        if(value instanceof Double){
            return Integer.parseInt(NumberUtils.format((Double) value, 0));
        }
        return null;
    }

    private Long getLong(String key) {
        Object value = get(key);
        if (value == null) {
            return null;
        }
        if(value instanceof Double){
            return Long.parseLong(NumberUtils.format((Double) value, 0));
        }
        return null;
    }

    @Override
    public Integer getExpandInt1() {
        return getInt("expandInt1");
    }

    @Override
    public void setExpandInt1(Integer expandInt1) {
        put("expandInt1", expandInt1);
    }

    @Override
    public Integer getExpandInt2() {
        return getInt("expandInt2");
    }

    @Override
    public void setExpandInt2(Integer expandInt2) {
        put("expandInt2", expandInt2);
    }

    @Override
    public Integer getExpandInt3() {
        return getInt("expandInt3");
    }

    @Override
    public void setExpandInt3(Integer expandInt3) {
        put("expandInt3", expandInt3);
    }

    @Override
    public Integer getExpandInt4() {
        return getInt("expandInt4");
    }

    @Override
    public void setExpandInt4(Integer expandInt4) {
        put("expandInt4", expandInt4);
    }

    @Override
    public Float getExpandFloat1() {
        return (Float) get("expandFloat1");
    }

    @Override
    public void setExpandFloat1(Float expandFloat1) {
        put("expandFloat1", expandFloat1);
    }

    @Override
    public Float getExpandFloat2() {
        return (Float) get("expandFloat2");
    }

    @Override
    public void setExpandFloat2(Float expandFloat2) {
        put("expandFloat2", expandFloat2);
    }

    @Override
    public Float getExpandFloat3() {
        return (Float) get("expandFloat3");
    }

    @Override
    public void setExpandFloat3(Float expandFloat3) {
        put("expandFloat3", expandFloat3);
    }

    @Override
    public Float getExpandFloat4() {
        return (Float) get("expandFloat4");
    }

    @Override
    public void setExpandFloat4(Float expandFloat4) {
        put("expandFloat4", expandFloat4);
    }

    @Override
    public Boolean getExpandBoolean1() {
        return (Boolean) get("expandBoolean1");
    }

    @Override
    public void setExpandBoolean1(Boolean expandBoolean1) {
        put("expandBoolean1", expandBoolean1);
    }

    @Override
    public Boolean getExpandBoolean2() {
        return (Boolean) get("expandBoolean2");
    }

    @Override
    public void setExpandBoolean2(Boolean expandBoolean2) {
        put("expandBoolean2", expandBoolean2);
    }

    @Override
    public Boolean getExpandBoolean3() {
        return (Boolean) get("expandBoolean3");
    }

    @Override
    public void setExpandBoolean3(Boolean expandBoolean3) {
        put("expandBoolean3", expandBoolean3);
    }

    @Override
    public Boolean getExpandBoolean4() {
        return (Boolean) get("expandBoolean4");
    }

    @Override
    public void setExpandBoolean4(Boolean expandBoolean4) {
        put("expandBoolean4", expandBoolean4);
    }

    @Override
    public Double getExpandDouble1() {
        return (Double) get("expandDouble1");
    }

    @Override
    public void setExpandDouble1(Double expandDouble1) {
        put("expandDouble1", expandDouble1);
    }

    @Override
    public Double getExpandDouble2() {
        return (Double) get("expandDouble2");
    }

    @Override
    public void setExpandDouble2(Double expandDouble2) {
        put("expandDouble2", expandDouble2);
    }

    @Override
    public Double getExpandDouble3() {
        return (Double) get("expandDouble3");
    }

    @Override
    public void setExpandDouble3(Double expandDouble3) {
        put("expandDouble3", expandDouble3);
    }

    @Override
    public Double getExpandDouble4() {
        return (Double) get("expandDouble4");
    }

    @Override
    public void setExpandDouble4(Double expandDouble4) {
        put("expandDouble4", expandDouble4);
    }

    @Override
    public Long getExpandLong1() {
        return getLong("expandLong1");
    }

    @Override
    public void setExpandLong1(Long expandLong1) {
        put("expandLong1", expandLong1);
    }

    @Override
    public Long getExpandLong2() {
        return getLong("expandLong2");
    }

    @Override
    public void setExpandLong2(Long expandLong2) {
        put("expandLong2", expandLong2);
    }

    @Override
    public Long getExpandLong3() {
        return getLong("expandLong2");
    }

    @Override
    public void setExpandLong3(Long expandLong3) {
        put("expandLong3", expandLong3);
    }

    @Override
    public Long getExpandLong4() {
        return getLong("expandLong4");
    }

    @Override
    public void setExpandLong4(Long expandLong4) {
        put("expandLong4", expandLong4);
    }

    @Override
    public String getExpandString1() {
        return (String) get("expandString1");
    }

    @Override
    public void setExpandString1(String expandString1) {
        put("expandString1", expandString1);
    }

    @Override
    public String getExpandString2() {
        return (String) get("expandString2");
    }

    @Override
    public void setExpandString2(String expandString2) {
        put("expandString2", expandString2);
    }

    @Override
    public String getExpandString3() {
        return (String) get("expandString3");
    }

    @Override
    public void setExpandString3(String expandString3) {
        put("expandString3", expandString3);
    }

    @Override
    public String getExpandString4() {
        return (String) get("expandString4");
    }

    @Override
    public void setExpandString4(String expandString4) {
        put("expandString4", expandString4);
    }
}
